/*
 * Copyright (c) 2022  by Junzhao
 * THIS FILE IS PART OF JAVASE Song Huongkang PROJECT
 * All Rights Reserved.
 */

package 练习;

public class test01 {
    public static void main(String[] args) {

        Person p1 = new Person();
        p1.name="xiaobai";
        p1.age=12;
        p1.showAge();
        p1.addAge(2);
        p1.showName();
        p1.study();
        p1.showAge();

        //两对象之间没关系 有一套自己的属性
        Person p2 = new Person();
        p2.name="xiaoguo";
        p2.age=14;
        p2.showAge();
        p2.addAge(2);
        p2.showName();
        p2.study();
        p2.showAge();
    }
}

class Person{

    String name;
    int age;
    int sex;

    public void study(){
        System.out.println("studying");
    }
    public void showName(){
        System.out.println("名字："+name);
    }

    public void showAge(){
        System.out.println("年龄："+age);
    }

    public int addAge(int x){
        age = x + age;
        return age;
    }

}